<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>xiarikui管理后台</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link href="/Public/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="/Public/bootstrap/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
    <link href="/Public/dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css" />
    <link href="/Public/dist/css/skins/_all-skins.min.css" rel="stylesheet" type="text/css" />
    <link href="/Public/plugins/iCheck/flat/blue.css" rel="stylesheet" type="text/css" />
    <link href="/Public/Admin/css/unify.css" rel="stylesheet" type="text/css" />
    <link rel="shortcut icon" href="/Public/images/favicon.ico" type="image/x-icon" />
    <script src="/Public/js/jQuery-2.1.4.min.js"></script>
    <script src="/Public/js/global.js"></script>
    <script src="/Public/js/myFormValidate.js"></script>
    <script src="/Public/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
    <script src="/Public/js/layer/layer-min.js"></script>
    <script src="/Public/js/myAjax.js"></script>
    <script type="text/javascript">
    function delfunc(obj) {
        layer.confirm('确认删除？', {
            btn: ['确定', '取消']
        }, function() {
            $.ajax({
                type: 'post',
                url: $(obj).attr('data-url'),
                data: {
                    act: 'del',
                    del_id: $(obj).attr('data-id')
                },
                dataType: 'json',
                success: function(data) {
                    if (data == 1) {
                        layer.msg('操作成功', {
                            icon: 1
                        });
                        $(obj).parent().parent().remove();
                    } else {
                        layer.msg(data, {
                            icon: 2,
                            time: 2000
                        });
                    }
                    layer.closeAll();
                }
            });
        }, function(index) {
            layer.close(index);
            return false;
        });
    }

    //全选
    function selectAll(name, obj) {
        $('input[name*=' + name + ']').prop('checked', $(obj).checked);
    }

    function get_help(obj) {
        layer.open({
            type: 2,
            title: '',
            shadeClose: true,
            shade: 0.3,
            area: ['90%', '90%'],
            content: $(obj).attr('data-url')
        });
    }

    function delAll(obj, name) {
        var a = [];
        $('input[name*=' + name + ']').each(function(i, o) {
            if ($(o).is(':checked')) {
                a.push($(o).val());
            }
        });
        if (a.length == 0) {
            layer.alert('请选择删除项', {
                icon: 2
            });
            return;
        }
        layer.confirm('确认删除？', {
            btn: ['确定', '取消']
        }, function() {
            $.ajax({
                type: 'get',
                url: $(obj).attr('data-url'),
                data: {
                    act: 'del',
                    del_id: a
                },
                dataType: 'json',
                success: function(data) {
                    if (data == 1) {
                        layer.msg('操作成功', {
                            icon: 1
                        });
                        $('input[name*=' + name + ']').each(function(i, o) {
                            if ($(o).is(':checked')) {
                                $(o).parent().parent().remove();
                            }
                        });
                    } else {
                        layer.msg(data, {
                            icon: 2,
                            time: 2000
                        });
                    }
                    layer.closeAll();
                }
            });
        }, function(index) {
            layer.close(index);
            return false;
        });
    }
    </script>
    <style type="text/css">
        .table > thead:first-child > tr:first-child > th{
            border-bottom: 0 none;
        } 
    </style>
</head>

<body>

<link href="/Public/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<script src="/Public/plugins/daterangepicker/moment.min.js" type="text/javascript"></script>
<script src="/Public/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<div class="wrapper">
    <div class="breadcrumbs" id="breadcrumbs">
    <ol class="breadcrumb">
        <?php if(is_array($navigate_admin)): foreach($navigate_admin as $k=>$v): ?><li><?php echo ($k); ?></li><?php endforeach; endif; ?>
    </ol>
</div>

    <section class="content" style="padding:0px 15px;">
        <div class="container-fluid">
            <div class="pull-right">
                <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
            </div>
            <div class="panel panel-default">
                <div class="panel-body ">
                    <ul class="nav nav-tabs">
                        <?php if(is_array($groupList)): foreach($groupList as $k=>$vo): ?><li <?php if($k == 'sms'): ?>class="active"<?php endif; ?>><a href="javascript:;" data-url="<?php echo U('System/index',array('inc_type'=>$k));?>" data-toggle="tab" onclick="goset(this)"><?php echo ($vo); ?></a></li><?php endforeach; endif; ?>
                    </ul>
                    <form method="post" id="handlepost" action="<?php echo U('System/handle');?>">

                        <div class="tab-content" style="padding:20px 0px;">
                            <div class="tab-pane active" id="tab_tongyong">
                                <table class="table table-bordered">
                                    <tbody>
                                         <tr>
                                            <td class = "align-right">云之讯[AppId]：</td>
                                            <td>
                                                <input type="text" class="form-control" msg = "云之讯[appid]"  name="sms_appid" value="<?php echo ($config["sms_appid"]); ?>">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="col-sm-2 align-right">云之讯[Account Sid]：</td>
                                            <td class="col-sm-8">
                                                <input type="text" class="form-control" msg = "云之讯[Account Sid]"  name="sms_account_sid" value="<?php echo ($config["sms_account_sid"]); ?>">
                                                <span id="err_attr_name" style="color:#F00; display:none;"></span>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class = "align-right">云之讯[Auth Token]：</td>
                                            <td>
                                                <input type="text" class="form-control" msg = "云之讯[token]"  name="sms_token" value="<?php echo ($config["sms_token"]); ?>">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class = "align-right">公司名/品牌名/产品名：</td>
                                            <td>
                                                <input type="text" class="form-control" msg = "公司名/品牌名/产品名"  name="sms_product" value="<?php echo ($config["sms_product"]); ?>">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class = "align-right">修改手机号短信模板ID：</td>
                                            <td>
                                                <input type="text" class="form-control" msg = "短信模板ID"  name="sms_code" value="<?php echo ($config["sms_code"]); ?>" placeholder="例如12345">
                                            </td>
                                        </tr>

                                         <tr>
                                             <td class = "align-right">申请会计师[成功]短信模板ID：</td>
                                             <td>
                                                 <input type="text" class="form-control" msg = "短信模板ID"  name="sms_apply_success" value="<?php echo ($config["sms_apply_success"]); ?>" placeholder="例如12345">
                                             </td>
                                         </tr>

                                         <tr>
                                             <td class = "align-right">申请会计师[失败]短信模板ID：</td>
                                             <td>
                                                 <input type="text" class="form-control" msg = "短信模板ID"  name="sms_apply_fail" value="<?php echo ($config["sms_apply_fail"]); ?>" placeholder="例如12345">
                                             </td>
                                         </tr>

                                        <tr>
                                            <td class = "align-right">注册启用短信：</td>
                                            <td>
                                    <input id="turnOn" type="radio" class="" name="regis_sms_enable" <?php if($config['regis_sms_enable'] == 1): ?>checked<?php endif; ?> value="1" >是
                                    <input type="radio"  class="" name="regis_sms_enable" <?php if($config['regis_sms_enable'] == 0): ?>checked<?php endif; ?> value="0" >否
                                    </td>
                                    </tr>
                                    <tr>
                                        <td class = "align-right">短信码超时时间：</td>
                                        <td>
                                            <select name="sms_time_out" class = "input-sm">
                                                <option value="60" <?php if($config['sms_time_out'] == 60): ?>selected="selected"<?php endif; ?>>1分钟</option>
                                                <option value="120" <?php if($config['sms_time_out'] == 120): ?>selected="selected"<?php endif; ?>>2分钟</option>
                                                <option value="300" <?php if($config['sms_time_out'] == 300): ?>selected="selected"<?php endif; ?>>5分钟</option>
                                                <option value="600" <?php if($config['sms_time_out'] == 600): ?>selected="selected"<?php endif; ?>>10分钟</option>
                                                <option value="1200" <?php if($config['sms_time_out'] == 1200): ?>selected="selected"<?php endif; ?>>20分钟</option>
                                                <option value="1800" <?php if($config['sms_time_out'] == 1800): ?>selected="selected"<?php endif; ?>>30分钟</option>
                                            </select>
                                        </td>
                                    </tr>
                                    </tbody>
                                    <tfoot>
                                        <tr>
                                            <td>
                                                <input type="hidden" name="inc_type" value="<?php echo ($inc_type); ?>">
                                            </td>
                                            <td class="text-right">
                                                <input class="btn btn-primary" type="button" onclick="adsubmit()" value="保存">
                                            </td>
                                        </tr>
                                    </tfoot>
                                </table>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
</div>
<script>
    function adsubmit() {
        if ($('#turnOn:checked').val() == true) {
            var num = 0;
            var str = "";
            $("input[type$='text']").each(function (n) {
                if ($(this).val() == "")
                {
                    num++;
                    str += $(this).attr("msg") + "不能为空！\r\n";
                }
            });
            if (num > 0)
            {
                alert(str);
                return false;
            } else
            {
                $('#handlepost').submit();
                //return true;
            }
        } else {
            $('#handlepost').submit();
        }
    }

    $(document).ready(function () {
        get_province();
    });

    function goset(obj) {
        window.location.href = $(obj).attr('data-url');
    }
</script>
</body>

</html>